import { produce } from 'immer';
import { useState } from 'react';

export function useImmer(baseState) {
  const [state, setState] = useState(baseState);
  const update = (updater) => {
    setState(produce(state, updater));
  };
  return [state, update];
} 